/*
 *  Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 *  This source code is licensed under the MIT license found in the LICENSE
 *  file in the root directory of this source tree.
 *
 */

/*
 *  THIS FILE IS AUTOGENERATED. DO NOT MODIFY IT; ALL CHANGES WILL BE LOST IN
 *  VAIN.
 *
 *  @generated
 */
#include "mcrouter/lib/carbon/test/gen/CarbonTestMessages.h"

#include "mcrouter/lib/carbon/test/gen/gen-cpp2/CarbonTest_types.h"

namespace carbon {
namespace test {
namespace thrift {

void TestRequest::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(key_ref(), fieldType);
        break;
      }
      case 2: {
        reader.readField(dummy2_ref(), fieldType);
        break;
      }
      case 3: {
        reader.readField(testBool_ref(), fieldType);
        break;
      }
      case 4: {
        reader.readField(testChar_ref(), fieldType);
        break;
      }
      case 5: {
        reader.readField(testInt8_ref(), fieldType);
        break;
      }
      case 6: {
        reader.readField(testInt16_ref(), fieldType);
        break;
      }
      case 7: {
        reader.readField(testInt32_ref(), fieldType);
        break;
      }
      case 8: {
        reader.readField(testInt64_ref(), fieldType);
        break;
      }
      case 9: {
        reader.readField(testUInt8_ref(), fieldType);
        break;
      }
      case 10: {
        reader.readField(testUInt16_ref(), fieldType);
        break;
      }
      case 11: {
        reader.readField(testUInt32_ref(), fieldType);
        break;
      }
      case 12: {
        reader.readField(testUInt64_ref(), fieldType);
        break;
      }
      case 13: {
        reader.readField(testFloat_ref(), fieldType);
        break;
      }
      case 14: {
        reader.readField(testDouble_ref(), fieldType);
        break;
      }
      case 15: {
        reader.readField(testShortString_ref(), fieldType);
        break;
      }
      case 16: {
        reader.readField(testLongString_ref(), fieldType);
        break;
      }
      case 17: {
        reader.readField(testIobuf_ref(), fieldType);
        break;
      }
      case 19: {
        reader.readField(testList_ref(), fieldType);
        break;
      }
      case 20: {
        reader.readField(testOptionalString_ref(), fieldType);
        break;
      }
      case 21: {
        reader.readField(testOptionalIobuf_ref(), fieldType);
        break;
      }
      case 22: {
        reader.readField(dummy22_ref(), fieldType);
        break;
      }
      case 23: {
        reader.readField(dummy23_ref(), fieldType);
        break;
      }
      case 24: {
        reader.readField(testNestedVec_ref(), fieldType);
        break;
      }
      case 25: {
        reader.readField(testUMap_ref(), fieldType);
        break;
      }
      case 26: {
        reader.readField(testMap_ref(), fieldType);
        break;
      }
      case 27: {
        reader.readField(testComplexMap_ref(), fieldType);
        break;
      }
      case 28: {
        reader.readField(testUSet_ref(), fieldType);
        break;
      }
      case 29: {
        reader.readField(testSet_ref(), fieldType);
        break;
      }
      case 30: {
        reader.readField(testOptionalBool_ref(), fieldType);
        break;
      }
      case 31: {
        reader.readField(dummy31_ref(), fieldType);
        break;
      }
      case 32: {
        reader.readField(testIOBufList_ref(), fieldType);
        break;
      }
      case 33: {
        reader.readField(testF14FastMap_ref(), fieldType);
        break;
      }
      case 34: {
        reader.readField(testF14NodeMap_ref(), fieldType);
        break;
      }
      case 35: {
        reader.readField(testF14ValueMap_ref(), fieldType);
        break;
      }
      case 36: {
        reader.readField(testF14VectorMap_ref(), fieldType);
        break;
      }
      case 37: {
        reader.readField(testF14FastSet_ref(), fieldType);
        break;
      }
      case 38: {
        reader.readField(testF14NodeSet_ref(), fieldType);
        break;
      }
      case 39: {
        reader.readField(testF14ValueSet_ref(), fieldType);
        break;
      }
      case 40: {
        reader.readField(testF14VectorSet_ref(), fieldType);
        break;
      }
      case 41: {
        reader.readField(testOptionalKeywordString_ref(), fieldType);
        break;
      }
      case 42: {
        reader.readField(testOptionalKeywordIobuf_ref(), fieldType);
        break;
      }
      case 43: {
        reader.readField(testOptionalKeywordBool_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void TestReply::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(result_ref(), fieldType);
        break;
      }
      case 2: {
        reader.readField(valInt32_ref(), fieldType);
        break;
      }
      case 3: {
        reader.readField(valInt64_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void TestRequestStringKey::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(key_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void TestReplyStringKey::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(result_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void TestOptionalBool::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(optionalBool_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void TestUnion::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readRawInto(set_a());
        break;
      }
      case 2: {
        reader.readRawInto(set_b());
        break;
      }
      case 3: {
        reader.readRawInto(set_c());
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void TestF14Containers::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(fastMap_ref(), fieldType);
        break;
      }
      case 2: {
        reader.readField(nodeMap_ref(), fieldType);
        break;
      }
      case 3: {
        reader.readField(valueMap_ref(), fieldType);
        break;
      }
      case 4: {
        reader.readField(vectorMap_ref(), fieldType);
        break;
      }
      case 5: {
        reader.readField(fastSet_ref(), fieldType);
        break;
      }
      case 6: {
        reader.readField(nodeSet_ref(), fieldType);
        break;
      }
      case 7: {
        reader.readField(valueSet_ref(), fieldType);
        break;
      }
      case 8: {
        reader.readField(vectorSet_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void TestStdContainers::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(fastMap_ref(), fieldType);
        break;
      }
      case 2: {
        reader.readField(nodeMap_ref(), fieldType);
        break;
      }
      case 3: {
        reader.readField(valueMap_ref(), fieldType);
        break;
      }
      case 4: {
        reader.readField(vectorMap_ref(), fieldType);
        break;
      }
      case 5: {
        reader.readField(fastSet_ref(), fieldType);
        break;
      }
      case 6: {
        reader.readField(nodeSet_ref(), fieldType);
        break;
      }
      case 7: {
        reader.readField(valueSet_ref(), fieldType);
        break;
      }
      case 8: {
        reader.readField(vectorSet_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void StructWithEnumUInt32::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(testEnum_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void StructWithEnumUInt16::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(testEnum_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void StructWithEnumUInt8::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(testEnum_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void StructWithEnumInt32::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(testEnum_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void StructWithEnumInt16::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(testEnum_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void StructWithEnumInt8::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(testEnum_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void StructWithOptionalEnumUInt32::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(testEnum_ref(), fieldType);
        break;
      }
      case 2: {
        reader.readField(testEmptyEnum_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void StructWithOptionalEnumUInt16::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(testEnum_ref(), fieldType);
        break;
      }
      case 2: {
        reader.readField(testEmptyEnum_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void StructWithOptionalEnumUInt8::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(testEnum_ref(), fieldType);
        break;
      }
      case 2: {
        reader.readField(testEmptyEnum_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void StructWithOptionalEnumInt32::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(testEnum_ref(), fieldType);
        break;
      }
      case 2: {
        reader.readField(testEmptyEnum_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void StructWithOptionalEnumInt16::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(testEnum_ref(), fieldType);
        break;
      }
      case 2: {
        reader.readField(testEmptyEnum_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void StructWithOptionalEnumInt8::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(testEnum_ref(), fieldType);
        break;
      }
      case 2: {
        reader.readField(testEmptyEnum_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}
} // namespace thrift
} // namespace test
} // namespace carbon
